package src.main.danli;

import java.util.HashMap;
import java.util.Map;
public class BankFactory {
    public static final Map<String, BankInfoQueryStrategy> MAP = new HashMap<>();
    private volatile static BankFactory INSTANCE;

    public BankFactory() {
        MAP.put("BOCOM", new BOCOMBankInfoQuery());
        MAP.put("ICBC", new ICBCBankInfoQuery());
    }

    public static BankFactory getInstance() {
        if (null == INSTANCE) {
            synchronized (BankFactory.class) {
                if (null == INSTANCE) {
                    INSTANCE = new BankFactory();

                }
            }
        }
        return INSTANCE;
    }

    public BankInfoQueryReqDto creatBankInfoquery(String type) {
        if (MAP.containsKey(type)) {
            return MAP.get(type).buildRequestData();
        }
//            log.error("不支持的银行类型");
            return null;
        }
    }